<%-- 
    Document   : tramitar
    Created on : 25/11/2009, 04:23:31 PM
    Author     : FreddyHIQ
--%>

<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<link href="/general/css/admin_1.css" rel="stylesheet" type="text/css"/>
<script language="JavaScript" type="text/javascript" src="/tramite/javaScript/scripts.js"></script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <t:div>
        <h:form styleClass="fondoFormulariosyPanel">
            <h:panelGrid columns="1" styleClass="rayaForms" width="100%">
                <h:outputLabel  value="Tramitar Solicitud" />
            </h:panelGrid>
            <h:messages id="lblMessages" showDetail="true" errorStyle="color:red;" infoStyle="color:blue;"/>
            <h:panelGrid columns="2" >
                <h:outputLabel value="Solicitante" />
                <h:outputText value="#{TramitesController.transaccion.fkSolCodigo.nombreDelSolicitante}"/>
            </h:panelGrid>
            <br><br>
            <rich:modalPanel height="100" width="200" id="Modal2" resizeable="false" moveable="false" showWhenRendered="true" rendered="#{TramitesController.modalObserv}">
                <f:facet name="header">
                    <h:panelGroup>
                        <h:outputText value="Observacion" />
                    </h:panelGroup>
                </f:facet>
                <h:panelGroup>
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Observacion:"/>
                        <h:inputTextarea value="#{TramitesController.docIncluido.dicObservacion}" />
                        <h:commandButton id="btnAceptar" value="Aceptar" action="#{TramitesController.aceptarObserv}"/>
                    </h:panelGrid>
                    <rich:componentControl for="Modal2" attachTo="btnAceptar" operation="hide" event="onclick"/>
                </h:panelGroup>
            </rich:modalPanel>
            <rich:modalPanel height="450" width="450" id="Modal1" resizeable="false" moveable="false" showWhenRendered="true" rendered="#{TramitesController.modal}">
                <f:facet name="header">
                    <h:panelGroup>
                        <h:outputText value="Voucher" />
                    </h:panelGroup>
                </f:facet>
                <h:panelGroup>
                    <a4j:mediaOutput styleClass="imagen2" element="img" session="true" align="middle" createContent="#{TramitesController.drawImage2}" mimeType="image/jpg" >
                        <a4j:support ajaxSingle="true" event="onclick" action="#{TramitesController.aceptarModal}" reRender="Modal1"/>
                    </a4j:mediaOutput>
                    <rich:componentControl for="Modal1" operation="hide" event="onclick"/>
                </h:panelGroup>
            </rich:modalPanel>
            <h:outputLabel value="Documentos a Tramitar" />
            <rich:dataTable value="#{TramitesController.documentosRecibidos}"
                            var="doc" rows="15" reRender="ds" id="simpletable" rowKeyVar="row"
                            width="100%" columnsWidth="20%, 20%, 20%, 10%, 30%" rowClasses="TableImpar,TablePar">
                <rich:column>
                    <f:facet name="header"> <h:outputLabel value="Tipo" /></f:facet>
                    <h:outputText value="#{doc.fkDocCodigo.fkTdoCodigo.tdoDesc}"></h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header"> <h:outputLabel value="Nombre" /></f:facet>
                    <h:outputText value="#{doc.fkDocCodigo.documentoImagen.dimNombre}"></h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header"> <h:outputLabel value="Estado" /></f:facet>
                    <h:outputText value="#{doc.dicEstado}"></h:outputText>
                </rich:column>
                <rich:column>
                    <f:facet name="header"> <h:outputLabel value="Archivo" /></f:facet>
                    <a4j:mediaOutput rendered="#{doc.tipo==2}" styleClass="imagen" element="img" session="true" align="middle" createContent="#{TramitesController.drawImage}" value="#{row}" mimeType="image/jpg" />
                    <h:graphicImage value="/img/word.png" alt="word" rendered="#{doc.tipo==3}"/>
                    <h:graphicImage value="/img/pdf.png" alt="pdf" rendered="#{doc.tipo==4}"/>
                    <h:graphicImage value="/img/excel.png" alt="excel" rendered="#{doc.tipo==5}"/>
                </rich:column>
                <rich:column>
                    <h:commandButton value="Ver" action="#{TramitesController.verImagen}" rendered="#{doc.tipo==2}">
                        <f:setPropertyActionListener target="#{TramitesController.rutaImagen}" value="#{doc.fkDocCodigo.documentoImagen.dimRuta}" />
                    </h:commandButton>
                    <h:commandButton value="verPdf" action="#" onclick="abrirVentana();" rendered="#{doc.tipo==4}">
                        <f:setPropertyActionListener target="#{TramitesController.docImagen}" value="#{doc.fkDocCodigo.documentoImagen}" />
                    </h:commandButton>
                    <h:commandButton value="verDoc" action="#{TramitesController.mostrarDoc}" rendered="#{doc.tipo==5 || doc.tipo==3}">
                        <f:setPropertyActionListener target="#{TramitesController.docImagen}" value="#{doc.fkDocCodigo.documentoImagen}" />
                    </h:commandButton>
                    &nbsp;
                    <h:commandButton value="Observar" action="#{TramitesController.verObservacion}" >
                        <f:setPropertyActionListener target="#{TramitesController.docIncluido}" value="#{doc}" />
                    </h:commandButton>
                    &nbsp;
                    <h:commandButton value="Aprobar" action="#{TramitesController.aprobar}" rendered="#{!doc.dicLectura}" >
                        <f:setPropertyActionListener target="#{TramitesController.docIncluido}" value="#{doc}" />
                    </h:commandButton>
                </rich:column>
            </rich:dataTable>
                    <a4j:commandButton value="Aprobar Operacion" action="#{TramitesController.aprobProc}" rendered="#{TramitesController.operAprob}"/>
        </h:form>
    </t:div>
</f:view>